package ie.dpsystems.errorlog;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;

public class AlarmConfiguration {

	private static final int REQUEST_CODE = 2;
    public static void StartAlarm(final Context context) {
  
        
        final PendingIntent alarmIntent = PendingIntent.getService(context, AlarmConfiguration.REQUEST_CODE,
        		new Intent(context, SyncService.class), PendingIntent.FLAG_UPDATE_CURRENT);

        final AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        
        // cancel any existing alarm
        am.cancel(alarmIntent);

        // Schedule the alarm
        am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(),AlarmManager.INTERVAL_FIFTEEN_MINUTES, alarmIntent);



      
    }
}
